var item_id;
var AdminPage = Objs("view.components.AdminPage",
	UiComponent,
{   
	summarylist:"",
   	makelist:"",
   	modellist:"",
   	searchlist:"",
   	statuslist:"",
   	addresourcelist:"",
   	userlist:"",
   	towerlist:"",
	searchtowerSubmit:"",
	towerRefresh:"",
	searchuserrefresh:"",
	searchuserSubmit:"",
	searchmakeSubmit:"",
	makerefresh:"",
	searchmodelSubmit:"",
	modelrefresh:"",
	savemake:"",
	addmodel:"",
	savemodel:"",
	editMake:"",
	editModel:"",
	adddri:"",
	addengine:"",
	addtrans:"",
	addwant:"",
	addcontact:"",
	addpaper:"",
	addlocated:"",
	adddeliver:"",
	addsource:"",
	addItembtn:"",
	editItembtn:"",

	initialize: function()
	{ 
		AdminPage.$super.initialize.call( this );
		
		this.initializeChildren();
		this.bindListeners();
	},
	
    initializeChildren: function()
    {
		this.makelist = jQuery("#makelist");
		this.summarylist = jQuery("#summarylist");
		//this.modellist = jQuery("#modellist");
		this.searchlist = jQuery("#searchlist");
		this.statuslist = jQuery("#statuslist");
		this.addresourcelist = jQuery("#addresourcelist");
		this.userlist = jQuery("#userlist");
		this.towerlist = jQuery("#towerlist");
		this.searchtowerSubmit = jQuery("#searchtowerSubmit");
		this.searchuserSubmit = jQuery("#searchuserSubmit");
		this.towerRefresh = jQuery("#searchtowerrefresh");
		this.searchuserrefresh = jQuery("#searchuserrefresh");
		this.makerefresh = jQuery("#makerefresh");
		this.searchmakeSubmit = jQuery("#searchmakeSubmit");
		this.searchmodelSubmit = jQuery("#searchmodelSubmit");
		this.modelrefresh = jQuery("#modelrefresh");
		this.savemake = jQuery("#savemake");
		this.addmodel = jQuery("#addmodel");
		this.savemodel = jQuery("#savemodel");
		this.editMake = jQuery("#editMake");
		this.editModel = jQuery("#editModel");
		this.adddri = jQuery("#adddri");
		this.addengine = jQuery("#addengine");
		this.addtrans = jQuery("#addtrans");
		this.addwant = jQuery("#addwant");
		this.addcontact = jQuery("#addcontact");
		this.addpaper = jQuery("#addpaper");
		this.addlocated = jQuery("#addlocated");
		this.adddeliver = jQuery("#adddeliver");
		this.addsource = jQuery("#addsource");
		this.addItembtn = jQuery("#addItembtn");
		this.editItembtn = jQuery("#editItembtn");
    },

	bindListeners: function()
	{
		var namespace = ".AdminPage";
   		this.makelist.on( "click"+namespace, jQuery.proxy( this, "makelist_clickHandler" ) );
   		this.summarylist.on( "click"+namespace, jQuery.proxy( this, "summarylist_clickHandler" ) );
   	//	this.modellist.on( "click"+namespace, jQuery.proxy( this, "modellist_clickHandler" ) );
   		this.searchlist.on( "click"+namespace, jQuery.proxy( this, "searchlist_clickHandler" ) );
   		this.statuslist.on( "click"+namespace, jQuery.proxy( this, "statuslist_clickHandler" ) );
   		this.addresourcelist.on( "click"+namespace, jQuery.proxy( this, "addresourcelist_clickHandler" ) );
   		this.userlist.on( "click"+namespace, jQuery.proxy( this, "userlist_clickHandler" ) );
   		this.towerlist.on( "click"+namespace, jQuery.proxy( this, "towerlist_clickHandler" ) );
   		this.searchtowerSubmit.on( "click"+namespace, jQuery.proxy( this, "searchtowerSubmit_clickHandler" ) );
		this.towerRefresh.on( "click"+namespace, jQuery.proxy( this, "towerRefresh_clickHandler" ) );
		this.searchuserrefresh.on( "click"+namespace, jQuery.proxy( this, "searchuserrefresh_clickHandler" ) );
		this.searchuserSubmit.on( "click"+namespace, jQuery.proxy( this, "userlist_clickHandler" ) );
		this.makerefresh.on( "click"+namespace, jQuery.proxy( this, "makerefresh_clickHandler" ) );
		this.searchmakeSubmit.on( "click"+namespace, jQuery.proxy( this, "makesearch_clickHandler" ) );
		this.searchmodelSubmit.on( "click"+namespace, jQuery.proxy( this, "modelsearch_clickHandler" ) );
		this.modelrefresh.on( "click"+namespace, jQuery.proxy( this, "modelrefresh_clickHandler" ) );
		
		
		this.savemake.on( "click"+namespace, jQuery.proxy( this, "savemake_clickHandler" ) );
		this.addmodel.on( "click"+namespace, jQuery.proxy( this, "addmodel_clickHandler" ) );
		this.savemodel.on( "click"+namespace, jQuery.proxy( this, "savemodel_clickHandler" ) );
		this.editMake.on( "click"+namespace, jQuery.proxy( this, "editMake_clickHandler" ) );
		this.editModel.on( "click"+namespace, jQuery.proxy( this, "editModel_clickHandler" ) );
		
		
		this.adddri.on( "click"+namespace, jQuery.proxy( this, "adddri_clickHandler" ) );
		this.addengine.on( "click"+namespace, jQuery.proxy( this, "addengine_clickHandler" ) );
		this.addtrans.on( "click"+namespace, jQuery.proxy( this, "addtrans_clickHandler" ) );
		this.addwant.on( "click"+namespace, jQuery.proxy( this, "addwant_clickHandler" ) );
		this.addcontact.on( "click"+namespace, jQuery.proxy( this, "addcontact_clickHandler" ) );
		this.addpaper.on( "click"+namespace, jQuery.proxy( this, "addpaper_clickHandler" ) );
		this.addlocated.on( "click"+namespace, jQuery.proxy( this, "addlocated_clickHandler" ) );
		this.adddeliver.on( "click"+namespace, jQuery.proxy( this, "adddeliver_clickHandler" ) );
		this.addsource.on( "click"+namespace, jQuery.proxy( this, "addsource_clickHandler" ) );
		this.addItembtn.on( "click"+namespace, jQuery.proxy( this, "addItembtn_clickHandler" ) );
		this.editItembtn.on( "click"+namespace, jQuery.proxy( this, "editItembtn_clickHandler" ) );
		
		
		
		
	},
	adddri_clickHandler:function()
	{
		item_id=1;
	},
	addengine_clickHandler:function()
	{
		item_id=2;
	},
	addtrans_clickHandler:function()
	{
		item_id=3;
	},
	addwant_clickHandler:function()
	{
		item_id=4;
	},
	addcontact_clickHandler:function()
	{
		item_id=5;
	},
	addpaper_clickHandler:function()
	{
		item_id=6;
	},
	addlocated_clickHandler:function()
	{
		item_id=7;
	},
	adddeliver_clickHandler:function()
	{
		item_id=8;
	},
	addsource_clickHandler:function()
	{
		item_id=9;
	},
	addItembtn_clickHandler:function()
	{
		this.dispatchEvent( AdminPage.ADDITEM );
	},
	editItembtn_clickHandler:function()
	{
		this.dispatchEvent( AdminPage.EDITITEM );
	},
	editModel_clickHandler:function()
	{
	
		this.dispatchEvent( AdminPage.EDITMODEL );
		
	},	
	editMake_clickHandler:function()
	{
	
		this.dispatchEvent( AdminPage.EDITMAKE );
		
	},
	addmodel_clickHandler:function()
	{
		
		this.dispatchEvent( AdminPage.ADDMODEL );
	},
	savemodel_clickHandler:function()
	{
		
		this.dispatchEvent( AdminPage.SAVEMODEL );
	},
	savemake_clickHandler:function()
	{
		
		this.dispatchEvent( AdminPage.MAKESAVE );
	},
	makerefresh_clickHandler:function()
	{
		$("#searchmake").val('');
		this.dispatchEvent( AdminPage.MAKEREFRESH );
	},
	makesearch_clickHandler:function()
	{
		
		this.dispatchEvent( AdminPage.MAKEREFRESH );
	},
	modelrefresh_clickHandler:function()
	{
		$("#searchmodel").val('');
		
		this.dispatchEvent( AdminPage.MODELREFRESH );
	},
	modelsearch_clickHandler:function()
	{
		
		this.dispatchEvent( AdminPage.MODELREFRESH );
	},
	towerRefresh_clickHandler:function()
	{
		$("#searchtower").val('');
		this.dispatchEvent( AdminPage.TOWERS );
	},
	searchuserrefresh_clickHandler:function()
	{
		$("#searchuser").val('');
		this.dispatchEvent( AdminPage.USERS );
	},
	
	searchtowerSubmit_clickHandler:function()
	{
		this.dispatchEvent( AdminPage.TOWERS );
	},
	makelist_clickHandler:function()
	{
		this.dispatchEvent( AdminPage.MAKE );
	},
	userlist_clickHandler:function()
	{
		this.dispatchEvent( AdminPage.USERS );
	},
	towerlist_clickHandler:function()
	{
		this.dispatchEvent( AdminPage.TOWERS );
	},
	summarylist_clickHandler:function()
	{
		this.dispatchEvent( AdminPage.SUMMARY );
	},
	modellist_clickHandler:function()
	{
		this.dispatchEvent( AdminPage.MODEL );
	},
	searchlist_clickHandler:function()
	{
		this.dispatchEvent( AdminPage.SEARCH );
	},
	statuslist_clickHandler:function()
	{
		this.dispatchEvent( AdminPage.STATUS );
	},
	addresourcelist_clickHandler:function()
	{
		this.dispatchEvent( AdminPage.ADDRESOURCE );
	},

});
AdminPage.MAKE="make";
AdminPage.SUMMARY="summary";
AdminPage.MODEL="model";
AdminPage.SEARCH="search";
AdminPage.STATUS="status";
AdminPage.ADDRESOURCE="addresorce";
AdminPage.USERS="users";
AdminPage.TOWERS="towers";
AdminPage.REFRESH="refresh";
AdminPage.MAKEREFRESH="makerefresh";
AdminPage.MODELREFRESH="modelrefresh";
AdminPage.MAKESAVE="savemake";
AdminPage.ADDMODEL="addmodel";
AdminPage.SAVEMODEL="savemodel";
AdminPage.EDITMAKE="edit_make";
AdminPage.EDITMODEL="edit_model";
AdminPage.ADDITEM="add_item";
AdminPage.EDITITEM="edit_item";
